import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { OptionsSharp } from '@vicons/ionicons5';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/working',
    name: 'Working',
    redirect: '/working/project/main',
    component: Layout,
    meta: {
      title: '工时管理',
      icon: renderIcon(OptionsSharp),
      sort: 1,
      permissions: ['working-project-main','working-record','working-project-project'],
    },
    children: [
      {
        path: 'project-main',
        name: 'project-main',
        meta: {
          title: '项目主体',
          permissions: ['working-project-main'],
        },
        component: () => import('@/views/working/projectMain/ProjectMain.vue'),
      },
      {
        path: 'project',
        name: 'project-project',
        meta: {
          title: '项目管理',
          permissions: ['working-project-project'],
        },
        component: () => import('@/views/working/project/Project.vue'),
      },
      {
        path: 'record',
        name: 'working-record',
        meta: {
          title: '工时记录',
          permissions: ['working-record'],
        },
        component: () => import('@/views/working/record/Record.vue'),
      },
      {
        path: 'declare',
        name: 'working-declare',
        meta: {
          title: '申报工时',
          permissions: ['working-declare'],
        },
        component: () => import('@/views/working/declare/Declare.vue'),
      },
    ],
  },
];

export default routes;
